package com.boot.project.core.enums.code.impl.commonCode;

import com.boot.project.core.enums.code.BaseCode;
import lombok.AllArgsConstructor;

/**
 * @description:
 * @author: tsing
 * @create: 2020-08-09 14:54
 */
@AllArgsConstructor
public enum ResultCode implements BaseCode {

    // 2.结果相关(2001~2999)
    INSERT_FAILURE(false, 2001,"新增失败"),
    UPDATE_FAILURE(false, 2002,"更新失败"),
    DELETE_FAILURE(false, 2003,"删除失败"),
    UPLOAD_FAILURE(false, 2004, "上传失败"),
    LOG_SAVE_FAILURE(false, 2005, "日志保存失败"),
    RETURN_DATA_NOT_FOUND(false, 2101, "没有查询到相关内容"),
    HANDLE_DATA_NOT_EXISTED(false, 2102, "没有需要操作的数据"),
    TOKEN_WRONG(false, 2201, "token解析失败"),
    TOKEN_EXPIRED(false, 2202, "token已经过期，请重新登录"),
    ;

    private Boolean success; // 是否成功
    private int code; // 状态码
    private String message; // 操作信息

    @Override
    public boolean success() {
        return this.success;
    }

    @Override
    public int code() {
        return this.code;
    }

    @Override
    public String message() {
        return this.message;
    }
}
